package com.whuan.user.util;

import com.whuan.user.dto.UserDTO;
import com.whuan.user.form.UserForm;

import java.text.SimpleDateFormat;
import java.util.Date;

public class UserDTOUtil {

    public static UserDTO getUserDTO(UserForm userForm){
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMdd");//设置日期格式 yyyyMMdd HHmmss
        String userId = df.format(new Date())+(int)(Math.random()*900+100);
        UserDTO userDTO = new UserDTO();
        userDTO.setUserId(userId);
        userDTO.setUserName(userForm.getName());
        userDTO.setUserPassword(userForm.getPassword());
        return userDTO;
    }
}
